package com.flywen.exception;

import com.flywen.enums.IErrorCodeEnum;

/**
 * @Author
 * @Create 2019-01-24 14:37
 * @Version 1.0
 * @Description
 */
public class AppException extends RuntimeException {
    private static final long serialVersionUID = -45950644483715464L;
    private String responseCode;
    private String errorMessage;

    public AppException(IErrorCodeEnum ErrorCodeEnum) {
        super(ErrorCodeEnum.getResponseCode() + ":" + ErrorCodeEnum.getResponseMsg());
        this.responseCode = ErrorCodeEnum.getResponseCode();
        this.errorMessage = ErrorCodeEnum.getResponseMsg();
    }

    public AppException(IErrorCodeEnum ErrorCodeEnum, String description) {
        super(ErrorCodeEnum.getResponseCode() + ":" + description);
        this.responseCode = ErrorCodeEnum.getResponseCode();
        this.errorMessage = description;
    }

    public AppException(String responseCode, String responseMsg) {
        super(responseCode + ":" + responseMsg);
        this.responseCode = responseCode;
        this.errorMessage = responseMsg;
    }

    public String getResponseCode() {
        return this.responseCode;
    }

    public Throwable fillInStackTrace() {
        return this;
    }

    public String getErrorMessage() {
        return this.errorMessage;
    }
}

